import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;


public class dlgMenu extends JDialog {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private final JPanel contentPanel = new JPanel();

	/**
	 * Create the dialog.
	 */
	// SuppressWarnings: There were some compatibility issues between Java 1.6 and 1.7, I don't really feel like
	// de-generalizing the JComboBox like the 1.7 compiler tells me to do because then the program won't compile
	// anymore in 1.6. Boo!
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public dlgMenu() {
		setTitle("Tesla Coil Model Start Menu");
		setBounds(100, 100, 450, 300);
		getContentPane().setLayout(new BorderLayout());
		contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
		getContentPane().add(contentPanel, BorderLayout.CENTER);
		contentPanel.setLayout(null);
		{
			JLabel lblPleaseSelectA = new JLabel("Please select a test class and click \"OK\".");
			lblPleaseSelectA.setBounds(78, 10, 287, 15);
			contentPanel.add(lblPleaseSelectA);
		}
		
		final JComboBox comboBox = new JComboBox();
		comboBox.setBounds(12, 46, 424, 24);
		contentPanel.add(comboBox);
		{
			JPanel buttonPane = new JPanel();
			buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
			getContentPane().add(buttonPane, BorderLayout.SOUTH);
			{
				JButton okButton = new JButton("OK");
				okButton.addMouseListener(new MouseAdapter() {
					@Override
					public void mouseClicked(MouseEvent e) {
						switch(comboBox.getSelectedIndex())
						{
							case 0:
								//version2.Version2 ver2=new version2.Version2();
								//ver2.launch(null);
								break;
								
							case 1:
								System.out.print("Testprogramm. Starte...");
								samples3d.Quads quads = new samples3d.Quads();
								quads.start();
								System.out.println("fertig!");
								break;
								
							case 2:
								simulation.Simulation sim=new simulation.Simulation();
								sim.launch(null);
								break;
								
							default:
								break;	
						}
						dispose();
					}
				});
				okButton.setActionCommand("OK");
				buttonPane.add(okButton);
				getRootPane().setDefaultButton(okButton);
			}
			{
				JButton cancelButton = new JButton("Exit");
				cancelButton.addMouseListener(new MouseAdapter() {
					@Override
					public void mouseClicked(MouseEvent arg0) {
						System.out.println("Clicked 'Exit'. Bye!");
						System.exit(0);
					}
				});
				cancelButton.setActionCommand("Cancel");
				buttonPane.add(cancelButton);
			}
		}
		comboBox.addItem("Version 2");
		comboBox.addItem("Sample: Quads");
		comboBox.addItem("Simulation");
	}
}
